#ifndef Matrix_H
#define Matrix_H

class Matrix
{
public:
	Matrix();
	Matrix(int h, int w);
	Matrix(int h, int w, double val);
	Matrix(const Matrix& m);
	virtual ~Matrix();
	void str(int h, int w);
	void ReadText(const char* filename); 
	void WriteText(const char* filename); 

	void Zeros(int h, int w); 
	void Ones(int h, int w); 
	void Random(int h, int w); 
	void Random(int h, int w, int);
	void Identity(int n); 
	int Height();
	int Width();
	Matrix MajorDiagonal();
	Matrix MinorDiagonal();
	Matrix Row(int n);
	Matrix Column(int n);
	void Transpose(); 
	double& At(int row, int col);
	void Set(int row, int col, double value); 
	void Set(double value); 
	void Normalize();
	void Reshape(int h, int w);
	bool IsEmpty();
	bool IsSquare();
	void CopyTo(Matrix& m);
	void Mult(double s); 
	void Cat(Matrix& m, int code); 

	friend Matrix Add(const Matrix& m1, const Matrix& m2);
	friend Matrix Sub(const Matrix& m1, const Matrix& m2);
	friend void Swap(Matrix& a, Matrix& b);

	void showMatrix();
protected:
	int Mat_he;
	int Mat_w;
	double** Mat_da;
};

#endif

